<!DOCTYPE html>
<html lang="en">
<include file="CommonSidebar:common-head"/>
<link rel="stylesheet" href="__ROOT__/Application/Admin/Public/css/common.css">
<link href="__ROOT__/Application/Admin/Public/css/jquery.datetimepicker.css" rel="stylesheet">
<link href="__PUBLIC__/Admin/css/bootstrap-datetimepicker.css" rel="stylesheet">
<body>

<div id="wrapper">

    <!-- Navigation -->
    <include file="CommonSidebar:common-navbar"/>

    <div id="page-wrapper">
        <div class="row">
            <div class="col-md-12">
                <h1 class="page-header">回收书籍</h1>
            </div>
        </div>
        <div class="row">
            <div class="col-md-12">
                <div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">
                    <div class="panel panel-default">
                        <div class="panel-heading" role="tab" id="headingOne">
                            <h4 class="panel-title">
                                <a role="button" data-toggle="collapse" data-parent="#accordion"
                                   href="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
                                    搜索栏
                                </a>
                            </h4>
                        </div>
                        <div id="collapseOne" class="panel-collapse collapse" role="tabpanel"
                             aria-labelledby="headingOne">
                            <div class="panel-body">
                                <form action="{:U('BookIndex')}" class="form-horizontal" method="get">
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">书籍名称</label>

                                        <div class="col-sm-4">
                                            <input class="form-control" name="ob_name" value="{$CSDATA.ob_name}">
                                        </div>
                                        <label class="col-sm-2 control-label">条形码</label>

                                        <div class="col-sm-4">
                                            <input class="form-control" name="isbn" value="{$CSDATA.isbn}">
                                        </div>
                                    </div>

                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">用户处理结果</label>

                                        <div class="col-sm-4">
                                            <select class="form-control" name="info" value="{$CSDATA.info}">
                                                <option value="">请选择</option>
                                                <option value="">用户为处理</option>
                                                <option value="奇妙阅自行处理">奇妙阅自行处理</option>
                                                <option value="跟购书订单一起寄回">跟购书订单一起寄回</option>
                                            </select>
                                        </div>

                                    </div>

                                    <div class="form-group">
                                        <div class="col-sm-10 col-sm-offset-2">
                                            <button type="submit" class="btn  btn-primary">筛选</button>
                                        </div>
                                    </div>
                                </form>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <!-- /.row -->
        <div class="row">
            <div class="col-lg-12">
                <div class="panel panel-default">

                    <!-- /.panel-heading -->
                    <div class="panel-body">
                        <div class="dataTable_wrapper">
                            <table class="table table-striped table-bordered table-hover" id="dataTables-example">
                                <include file="Extends/searchForUser"/>
                                <thead>
                                <tr>
                                    <th style="text-align:center"><input name="all_checkbox" type='checkbox'
                                                                         id="all_checkbox"></th>
                                    <th class="text-center GridSortTh" width="11%" data-order="isbn">条形码</th>
                                    <th class="text-center GridSortTh" style="text-align:center"
                                        data-order="ob_book_pic">书籍图片
                                    </th>
                                    <th style="text-align:center" class="text-center GridSortTh" data-order="ob_name"
                                        width="250px">书名
                                    </th>
                                    <th style="text-align:center" class="text-center GridSortTh"
                                        data-order="ob_old_money">定价
                                    </th>
                                    <th style="text-align:center" class="text-center GridSortTh"
                                        data-order="ob_pay_money">回收价
                                    </th>
                                    <th style="text-align:center;width: 20%;">备注</th>
                                    <th style="text-align:center" width="10%">操作</th>
                                </tr>
                                </thead>
                                <tbody>
                                <foreach name="DATA" item="v">
                                    <tr>
                                        <td><input type='checkbox' name='checkbox'></td>
                                        <td><a target='_blank' href="{:U('Book/index')}?ISBN={$v.isbn}">
                                            <span class="text-danger">{$v.isbn}</span></a>
                                        </td>
                                        <td><img width="80px" src="{$v.ob_book_pic}"></td>
                                        <td>{$v.ob_name}</td>
                                        <td>{$v.ob_old_money}</td>
                                        <td>{$v.ob_pay_money}</td>
                                        <td>{$v.info}</td>
                                        <td>
                                            <a target='_blank'
                                               href="{:U('GetOrder/Index')}?order_id={$v.order_id}&order_type=0"><span
                                                    class="btn btn-warning btn-xs">查看订单</span></a><br/>
                                        </td>

                                    </tr>
                                </foreach>
                                </tbody>
                            </table>
                            <div class="blue">{$show}</div>
                        </div>
                        <!-- /.table-responsive -->
                    </div>
                    <!-- /.panel-body -->
                </div>
                <!-- /.panel -->
            </div>
            <!-- /.col-lg-12 -->
        </div>
        <!-- /.row -->
    </div>
    <!-- /#page-wrapper -->
</div>
<include file="CommonSidebar:common-script"/>
<script src="__PUBLIC__/Admin/bower_components/datatables/media/js/jquery.dataTables.min.js"></script>
<script src="__PUBLIC__/Admin/bower_components/datatables-plugins/integration/bootstrap/3/dataTables.bootstrap.min.js"></script>
<script src="__PUBLIC__/Common/grid.js"></script>
<script src="__ROOT__/Application/Admin/Public/dist/js/sb-admin-2.js"></script>
<script type="text/javascript">
    $('#dataTables-example').grid();
</script>
<script>
    //加入主库
    function AddBook(ID, $elem, top) {
        if (confirm("确认操作？")) {
            $.post("{:U('AddBook')}",
                    {ID: ID, TOP: top},
                    function (data) {
                        if (parseInt(data) > 0) {
                            $elem.parent().parent().remove();
                            alert('加入成功');
                        } else {
                            alert('加入失败');
                        }
                    });
        }
    }

    //    排序
    function sort(elem) {
        var sortNAME = elem.attr("name");
        var isDESC = elem.attr("data-type");
        if (isDESC) {
            if (isDESC == 'DESC') {
                isDESC = 'ASC'
            } else {
                isDESC = 'DESC'
            }
        } else {
            isDESC = 'DESC'
        }
        location.href = "{:U('Index')}?sortNAME=" + sortNAME + "&isDESC=" + isDESC;
        //location.href实现客户端页面的跳转
    }
    //    显示操作
    function showcz(elem) {
        if (elem.next().next().is(":hidden")) {
            elem.next().next().show();    //如果元素为隐藏,则将它显现
        } else {
            elem.next().next().hide();     //如果元素为显现,则将其隐藏
        }
    }


    <!--全选择框-->
    $("#all_checkbox").click(function () {
        if ($(this).is(':checked')) {
            $("input[name='checkbox']").prop("checked", "true");
        } else {
            $("input[name='checkbox']").removeAttr("checked", false);

        }
    });
    //删除
    function del(ID, $elem) {
        if (confirm("确认删除？")) {
            $.post("{:U('delete')}",
                    {ID: ID},
                    function (data) {
                        if (parseInt(data) == 1) {
                            $elem.parent().parent().remove();
                            alert('删除成功');
                        } else {
                            alert('删除失败');
                        }
                    });
        }
    }


</script>
</body>
</html>
